home *** CD-ROM | disk | FTP | other *** search
/ Best of Shareware / Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso / mac / DOS / MATH / FSULTRA1 / ULTRA_C.ASM < prev    next >
Assembly Source File  |  1992-06-18  |  3KB  |  147 lines

  1. comment ! 
  2. FSU - ULTRA    The greatest random number generator that ever was
  3.         or ever will be.  Way beyond Super-Duper.
  4.         (Just kidding, but we think its a good one.)
  5.  
  6. Authors:    Arif Zaman (arif@stat.fsu.edu) and
  7.         George Marsaglia (geo@stat.fsu.edu).
  8.  
  9. Date:        27 May 1992
  10.  
  11. Version:    1.05
  12.  
  13. Copyright:    To obtain permission to incorporate this program into
  14.         any commercial product, please contact the authors at
  15.         the e-mail address given above or at
  16.  
  17.         Department of Statistics and
  18.         Supercomputer Computations Research Institute
  19.         Florida State University
  20.         Tallahassee, FL 32306.
  21.  
  22. See Also:    README        for a brief description
  23.         ULTRA.DOC    for a detailed description
  24.  
  25. -----------------------------------------------------------------------
  26. ;
  27. ; File: ULTRA_C.ASM  (Turbo C calling conventions)
  28. ;
  29.     ifdef     __TINY__
  30.         m equ tiny
  31.     elseifdef __SMALL__
  32.         m equ small
  33.     elseifdef __COMPACT__
  34.         m equ compact
  35.     elseifdef __MEDIUM__
  36.         m equ medium
  37.     elseifdef __LARGE__
  38.         m equ large
  39.     elseifdef __HUGE__
  40.         m equ huge
  41.     endif
  42.     DOSSEG
  43.     .MODEL m,c
  44.  
  45. ;===== GLOBAL FUNCTIONS, SUBROUTINES and VARIABLES =================
  46. ;
  47.     public  i31bit, i15bit, i7bit,  i1bit,  uni,    duni
  48.     public  i32bit, i16bit, i8bit,  rinit,  vni,    dvni
  49.     public    swbstate, swbsize
  50.  
  51. ;===== MACRO DEFINITIONS ===========================================
  52. ;
  53. ; RinitProcStart should take two 32-bit arguments conx and shrx
  54. ;   and place them in the data segment in congx and shrgx.
  55. ;   es and ds should both point to the data segment.
  56. ;   conx must be odd (so we or with 1 just to make sure).
  57. ; FillProc
  58. ;   DS is already the data segment. ES should also be made the same.
  59.  
  60. EnterProcedure   macro    saveregs
  61.     if @DataSize eq 2
  62.     mov  dx,@DATA
  63.     push ds
  64.     mov  ds,dx
  65.     endif
  66.     irp reg,saveregs
  67.     ifidn    <reg>,<si>
  68.         push si
  69.     elseifidn <reg>,<di>
  70.         push di
  71.     endif
  72.     endm
  73. endm
  74.  
  75. ExitProcedure    macro    saveregs
  76.     irp reg,saveregs
  77.     ifidn    <reg>,<di>
  78.         pop di
  79.     elseifidn <reg>,<si>
  80.         pop si
  81.     endif
  82.     endm
  83.     if @DataSize eq 2
  84.       pop ds
  85.     endif
  86.     ret
  87. endm
  88.  
  89. Enter2arg    macro
  90.   arg conx:dword, shrx:dword
  91.   EnterProcedure <si,di>
  92.     mov ax,ds
  93.     mov es,ax
  94.     mov ax,word ptr conx
  95.     shl ax,1
  96.     mov conglo,ax
  97.     mov ax,word ptr conx+2
  98.     rcl ax,1
  99.     mov conghi,ax
  100.     or  byte ptr conglo,1
  101.     mov ax,word ptr shrx
  102.     mov shrglo,ax
  103.     mov ax,word ptr shrx+2
  104.     mov shrghi,ax
  105. endm
  106.  
  107. Exit2arg    macro
  108.   ExitProcedure <di,si>
  109. endm
  110.  
  111. EnterFill    macro
  112.     push    si
  113.     push    di
  114.     mov    ax,ds
  115.     mov    es,ax
  116. endm
  117.  
  118. ExitFill    macro
  119.     pop    di
  120.     pop    si
  121.     ret
  122. endm
  123.  
  124. DwordFn macro
  125. endm
  126.  
  127. WordFn  macro
  128. endm
  129.  
  130. ByteFn  macro
  131. endm
  132.  
  133. RealFn  macro
  134. endm
  135.  
  136. DoubleFn macro
  137. endm
  138.  
  139. .DATA
  140.   INCLUDE ULTRADAT.INC
  141.  
  142. .CODE
  143.   INCLUDE ULTRACOD.INC
  144.  
  145. END
  146.